package jp.ddo.trismegistos.framework.util;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;

public class CopyUtil {

	public static void copy(final Object obj, final HashMap<String, Object> map) {

		for (final Map.Entry<String, Object> entry : map.entrySet()) {
			try {
				final Field f = obj.getClass().getDeclaredField(entry.getKey());
				if (f != null) {
					f.setAccessible(true);
					f.set(obj, entry.getValue());
				}
			} catch (SecurityException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (NoSuchFieldException e) {
			} catch (IllegalArgumentException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
